// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   HashFactory.java

package gnu.crypto.hash;

import java.util.*;

// Referenced classes of package gnu.crypto.hash:
//            Sha160, IMessageDigest

public class HashFactory
{

    private HashFactory()
    {
    }

    public static IMessageDigest getInstance(String name)
    {
        if(name == null)
            return null;
        name = name.trim();
        IMessageDigest result = null;
        if(name.equalsIgnoreCase("sha-160"))
            result = new Sha160();
        if(result != null && !result.selfTest())
            throw new InternalError(result.name());
        else
            return result;
    }

    public static final Set getNames()
    {
        HashSet hs = new HashSet();
        hs.add("whirlpool");
        hs.add("ripemd128");
        hs.add("ripemd160");
        hs.add("sha-160");
        hs.add("sha-256");
        hs.add("sha-384");
        hs.add("sha-512");
        hs.add("tiger");
        hs.add("haval");
        hs.add("md5");
        hs.add("md4");
        hs.add("md2");
        return Collections.unmodifiableSet(hs);
    }
}
